Learn R Programming

pbdDEMO (version 0.2-0)

Parallel NetCDF4: Read and Write Parallel NetCDF4 Files in GBD and ddmatrix Format

Description

These functions write and read NetCDF4 files in GBD and ddmatrix format.

Usage

ncvar_get_dmat(nc, varid, verbose = FALSE, signedbyte = TRUE,
    collapse_degen = TRUE, bldim = .DEMO.CT$bldim,
    ICTXT = .DEMO.CT$ictxt, comm = .SPMD.CT$comm)
ncvar_get_gbd(nc, varid, verbose = FALSE, signedbyte = TRUE,
    collapse_degen = TRUE, comm = .SPMD.CT$comm,
    gbd.major = .DEMO.CT$gbd.major)
ncvar_put_dmat(nc, varid, vals, verbose = FALSE,
    comm = .SPMD.CT$comm)
ncvar_put_gbd(nc, varid, vals, verbose = FALSE,
    comm = .SPMD.CT$comm, gbd.major = .DEMO.CT$gbd.major)

Arguments

nc
an object of class ncdf4 (as returned by either function nc_open_par or function nc_create_par), indicating what file to read from.
varid
See ncvar_get for details.
verbose
See ncvar_get for details.
signedbyte
See ncvar_get for details.
collapse_degen
See ncvar_get for details.
vals
See ncvar_put for details.
gbd.major
a GBD major, either 1 for row-major or 2 for column-major.
bldim
the blocking dimension for block-cyclically distributing the matrix across the process grid.
ICTXT
BLACS context number for return.
comm
a communicator number.

Value

  • ncvar_get_dmat returns a ddmatrix, and ncvar_get_gbd returns a GBD matrix in either row- or column major specified by gbd.major.

Details

ncvar_get_* are similar to ncvar_get of pbdNCDF4, but focus on 2D arrays and return a ddmatrix or GBD matrix.

ncvar_put_* are also similar to ncvar_put of pbdNCDF4, but only dump 2D arrays.

References

Programming with Big Data in R Website: http://r-pbd.org/

See Also

.DEMO.CT.

Examples

Run this code
### Under command mode, run the demo with 4 processors by
### (Use Rscript.exe for windows system)
mpiexec -np 4 Rscript -e "demo(nc4_serial,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(nc4_parallel,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(nc4_dmat,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(nc4_gbdc,'pbdDEMO',ask=F,echo=F)"

Run the code above in your browser using DataLab